** Replication Code for:
** Terrorism Activates Ethnocentrism to Explain Greater Willingness to 
** Sacrifice Civil Liberties: Evidence from Germany
** Authors: Christina Novak Hansen and Peter Thisted Dinesen 
** Date: 10/02/2021

*-------------------------------------------------------------------------------

clear all

*-------------------------------------------------------------------------------
*Appendix C: The salience of terrorism and public opinion in the context of 
*the July 2016 terrorist attacks
*-------------------------------------------------------------------------------


					 ***Overview of media analysis***

/*In order to understand the salience of terrorism surrounding the July 2016 
terrorists attacks we conducted a media analysis. We analysed the salience of 
terrorism throughout the GGSS data collection period, by searching for the 
frequency of online and offline news articles containing the word "terror"
- or the German variations of this word - in popular German news outlets. 
Specifically, we searched for the term "terror*" (the * capturing varations of
"terror", including the German equivalents of the words terrorist, terrorists, 
terrorism, terror's, terrorist's and terrorists') restricting the time period
to 01.03.2016-30.09.2016 (overlapping with the GGSS data collection period). 

To identify the number of daily articles refering to terrorism in the
following news outlets we used NexisLexis: 

	- Bild, Bild.de
	- Die Tageszeitung (TAZ) 
	- Die Zeit, Zeit Magazin, Zeit Online
 
 The same procedure was repeated for the following news outlets, where we 
 searched the news outlets' online archives for offline and online articles 
 containing references to terrorism:

	- Frankfurter Allgemeine Zeitung (FAZ) (accessed via: https://fazarchiv.faz.net/)
	- Süddeutsche Zeitung (SZ), Süddeutsche.de, SZ Magazin (accessed via: https://www.sz-archiv.de/)

	
For each group of publications - those found via NexisLexis, those related to
FAZ and those related to SZ - we noted the number of articles per day containing
references to terrorism in an excel spreadsheet. This dataset forms the basis 
for the following salience analysis of terrorism during the GGSS data collection
period.  
*/

*-------------------------------------------------------------------------------

							***Media analysis***
							
								*Figure C1*
							
import excel "C:\Users\CNovakhansen\Dropbox\2. Political Science\Artikel_ethno_2019\PSRM\Revision 1\Data for submission\Media_data_version_09-02-2021.xlsx", sheet("Ark1") firstrow


gen terrorcount_all = t_FAZ + t_SZ + t_TAZ_Bild_Zeit


*Timing of high-profile terrorist attacks during the fieldwork period 
gen reflines=.
replace reflines = 140 if edate==td(22/03/2016) /*Brussels*/
replace reflines = 140 if edate==td(12/06/2016) /*Orlando*/
replace reflines = 140 if edate==td(14/07/2016) /*Nice*/
replace reflines = 140 if edate==td(18/07/2016) /*Würzburg*/
replace reflines = 140 if edate==td(22/07/2016) /*Munich*/
replace reflines = 140 if edate==td(24/07/2016) /*Ansbach*/
replace reflines = 140 if edate==td(26/07/2016) /*Normandy*/


*Mean number of articles in entire period
sum terrorcount_all
*Mean number of articles 44.61, rounded up 45 articles.

gen meanarticles =.
replace meanarticles = 45 if terrorcount_all !=.


twoway (line meanarticles edate, lcolor(gs4) lpattern(vshortdash)) ///
	(spike reflines edate, lcolor(gs6)) (line terrorcount_all edate, lcolor(black)), ///
	ytitle(Number of articles per day (n)) ytitle(, size(medsmall)) ///
	ylabel(0(20)140, labsize(medsmall) angle(horizontal) grid) xtitle(Date) ///
	xtitle(, size(medsmall)) xlabel(, angle(stdarrow)) ///
	legend(order(3 "Number of articles per day with reference to terrorism" ///
	1 "Mean number of articles in entire period") cols(1) region(lwidth(none))) ///
	xsize(7) plotregion(margin(zero))

	*Write city/town names for terrorist attacks manually in the graph editor.

graph export Figure_C1.pdf, replace
	
*Labels signifying location of terrorist attack is added manually added in the
*graph editor.


*After Brussels attack
sum terrorcount_all if edate>=td(23/03/2016) & edate<=td(05/04/2016)

*Orlando
sum terrorcount_all if edate>=td(13/06/2016) & edate<=td(26/06/2016)

*July terrorist attacks
*First week after Nice attack
sum terrorcount_all if edate>=td(15/07/2016) & edate<=td(28/07/2016)
*Second week after Nice attack
sum terrorcount_all if edate>=td(29/07/2016) & edate<=td(11/08/2016)

*First 4 weeks after Nice truck attack
sum terrorcount_all if edate>=td(15/07/2016) & edate<=td(11/08/2016)
*Level in August
sum terrorcount_all if edate>=td(01/08/2016) & edate<=td(31/08/2016)

*-------------------------------------------------------------------------------


